home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
ov_all.zip
/
TI630.ASC
< prev
next >
Wrap
Text File
|
1991-09-11
|
7KB
|
199 lines
PRODUCT : ObjectVision NUMBER : 630
VERSION : 1.0
OS : WIN
DATE : September 11, 1991 PAGE : 1/3
TITLE : Creating an Incremental Number Field in ObjectVision
Description - The following instructions describe how to set up
an ObjectVision form that creates a unique and ordered record
number when a new record is created.
How it works - Two fields are created in ObjectVision, "Number"
and "New Number". "Number" corresponds to a keyed field in a
Paradox file. "New Number" is defined as "Number" plus one. A
third field, "Text", is inserted to demonstrate a data field. Two
links are set up. One, called "Number Link", is simply a
direct read and write link to the corresponding fields "Number"
and "Text" in the Paradox table. The other, called "New Number
Link", has a read link from "Number" in ObjectVision to "Number"
in the Paradox table. The write link, however, is from the field
"New Number" in ObjectVision, which has the value of the "Number"
field in ObjectVision plus one. The "Text" field in ObjectVision
has a read link from the "Text" field in Paradox. The write link
is from the field "Blank" in ObjectVision. This ensures a blank
field is inserted into the newly created field.
A button called "New" is created. It uses three functions:
@BOTTOM("New Number Link"), @INSERT("New Number Link") and
another @BOTTOM("New Number Link"). What this button does when
pressed follows: First it places the "New Number Link" link at
the bottom of the table. The "Number" field in ObjectVision now
has the value of the last field in the table. It appends a
record, writing the "New Number" field instead of the "Number"
field. "New Number" has the value of the "Number" field plus
one. This effectively inserts a unique and ordered number for
each new record at the bottom of the table. The second @BOTTOM
function simply places the link at the bottom of the table.
The "New Number Link" link should not be used for anything other
than executing the "New" button function. Key violations and
other errors can occur if this link is used for anything else.
The second link, "Number Link", is used only for demonstration.
This shows how a different link can safely be used to view and
update the data without these problems.
Instructions:
A.) Create the form:
1.) Start with a blank form.
2.) Create two fields named "Number" and "Text".
PRODUCT : ObjectVision NUMBER : 630
VERSION : 1.0
OS : WIN
DATE : September 11, 1991 PAGE : 2/3
TITLE : Creating an Incremental Number Field in ObjectVision
3.) Using Properties|Field Type, make the "Number" field a
Fixed field with zero decimal places. Leave the "Text"
field as general.
B.) Create the New Number Link:
1.) Using the Tools|Links command, create a Paradox link.
The "Link Name" should be "New Number Link". The
"Paradox Table Name" should be "NewNum" (be sure to start
with a new table). Now select the "OK" option. It will
create the new table at this point. Answer "OK" when it
prompts "Unable to open Paradox table. Create a new
table named NewNum?". Be sure to answer "NO" when it
asks to "Automatically add appropriate buttons for new
link named New Number Link".
2.) You will now be placed at the original link tool menu.
Select "Modify" to modify "New Number link". Use the
Connect button to create a read link from the "Number"
field in ObjectVision to the "Number" field in the
Paradox table. For the write link, select <Add New
Field> and create a field called "New Number".
3.) Use the Connect button to create a read link from the
"Text" field in ObjectVision to the "Text" field in the
Paradox table. For the write link, select <Add New
Field> and create a field called "Blank". Select "OK"
twice to exit the link tool.
C.) Format the "New Number" field:
1.) Select Tools|Tree, Tree|Select and select the "New
Number" field.
2.) Using Objects|Conclusion, create a conclusion that says
"+Number+1" (don't include the quotes). Now exit the Tree
tool.
D.) Create a general purpose link:
1.) Using Tools|Links, create another Paradox link called
"Number Link". Use the same table created before,
"NewNum". Select "OK" to establish the link. When it
says "Unable to open link until all index fields are
connected to read links", select "OK".
2.) Use the Connect button to create a read/write link from
the "Number" field in ObjectVision to the "Number" field
in the Paradox table.
3.) The ObjectVision "Text" field should have a read/write
PRODUCT : ObjectVision NUMBER : 630
VERSION : 1.0
OS : WIN
DATE : September 11, 1991 PAGE : 3/3
TITLE : Creating an Incremental Number Field in ObjectVision
link to the "Text" field in the Paradox table.
4.) Exit the link tool. This time answer "YES" when it asks
to "Automatically add appropriate buttons for new link
named Number Link".
E.) Create the Link button:
1.) Create a button called "New". Using the Tools|Tree tool,
type the following conclusion on the "New" button:
@BOTTOM("New Number Link") <CTRL><ENTER>
@INSERT("New Number Link") <CTRL><ENTER>
@BOTTOM("New Number Link")
(<CTRL><ENTER> creates a new line without exiting the
conclusion Dialog box.)
2.) Now exit the Tree tool and the Form tool.
F.) Initiate the table with a zero:
1.) Place a zero in the "Number" field. Select the "New"
button. When it prompts "Operation on an empty table"
select "OK".
When you want to create a new record, select the "New" button.
This creates a blank record with a new number. When you want to
enter a value into a record, select the "Enter" button. Values
entered into these new fields will be shaded. This is because
these fields will be considered overridden by ObjectVision. For
more information about overridden values, see "Overriding values"
of Chapter one, "ObjectVision: An Overview", in the Reference
Guide.
This form is now ready to go.